<template>
  <div>
    <el-form
      :inline="true"
      v-show="isSearchCollapse"
      class="query-form"
      ref="searchForm"
      :model="searchForm"
      @keyup.enter.native="refreshList()"
      @submit.native.prevent
    >
      <!-- 搜索框-->
      <el-form-item v-if="this.sysNo == 1" prop="shopId">
        <GridSelect
          title="选择店铺"
          labelName="shopName"
          labelValue="id"
          :value="searchForm.shopId"
          :limit="1"
          size="small"
          @getValue="
            (value) => {
              searchForm.shopId = value;
            }
          "
          :columns="[
            {
              prop: 'id',
              label: '主键',
            },
            {
              prop: 'shopName',
              label: '门店名称',
            },
            {
              prop: 'shopIntroduce',
              label: '门店介绍',
            },
            {
              prop: 'contacts',
              label: '联系人',
            },
            {
              prop: 'contactsPhone',
              label: '联系人电话',
            },
            {
              prop: 'delFlags',
              label: '是否注销',
            },
          ]"
          :searchs="[
            {
              prop: 'shopName',
              label: '门店名称',
            },
          ]"
          dataListUrl="/tshopinfo/tShopInfo/list"
          entityBeanName="tShopInfo"
          queryEntityUrl="/tshopinfo/tShopInfo/queryById"
        >
        </GridSelect>
      </el-form-item>
      <el-form-item prop="phone">
        <el-input
          size="small"
          v-model="searchForm.phone"
          placeholder="发布人手机号"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item prop="nikeName">
        <el-input
          size="small"
          v-model="searchForm.user.nikeName"
          placeholder="发布人"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item prop="title">
        <el-input
          size="small"
          v-model="searchForm.title"
          placeholder="房源标题"
          clearable
        ></el-input>
      </el-form-item>
      <!-- <el-form-item prop="transactionType">
            <el-select v-model="searchForm.transactionType" placeholder="请选择买卖类型" size="small" style="width: 100%;">
              <el-option label="出租" value="1">出租</el-option>
              <el-option label="售卖" value="2">售卖</el-option> 
            </el-select> 
         </el-form-item> -->
      <el-form-item prop="newOld">
        <el-select
          v-model="searchForm.newOld"
          placeholder="请选择新旧"
          size="small"
          style="width: 100%"
        >
          <el-option label="新房" value="1">新房</el-option>
          <el-option label="二手房" value="2">二手房</el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="type">
        <el-select
          v-model="searchForm.type"
          placeholder="请选择房源类型"
          size="small"
          style="width: 100%"
        >
          <el-option
            v-for="item in valueList"
            v-if="item.type == 1"
            :key="item.valueNum"
            :label="item.valueName"
            :value="item.valueNum"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="region">
        <el-select
          v-model="searchForm.region"
          placeholder="请选择区域"
          size="small"
          style="width: 100%"
        >
          <el-option
            v-for="item in valueList"
            v-if="item.type == 7"
            :key="item.valueNum"
            :label="item.valueName"
            :value="item.valueName"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="cellName">
        <el-input
          size="small"
          v-model="searchForm.cellName"
          placeholder="小区名称"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item prop="houseType">
        <el-select
          v-model="searchForm.houseType"
          placeholder="请选择户型"
          size="small"
          style="width: 100%"
        >
          <el-option
            v-for="item in valueList"
            v-if="item.type == 3"
            :key="item.valueNum"
            :label="item.valueName"
            :value="item.valueName"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="upStatus">
        <el-select
          v-model="searchForm.upStatus"
          placeholder="选择上架状态"
          size="small"
          style="width: 100%"
        >
          <el-option label="上架" value="1">上架</el-option>
          <el-option label="未上架" value="0">未上架</el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="isShow">
        <el-select
          v-model="searchForm.isShow"
          placeholder="是否首页显示"
          size="small"
          style="width: 100%"
        >
          <el-option label="显示" value="1">显示</el-option>
          <el-option label="不显示" value="0">不显示</el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="whetherRefresh">
        <el-select v-model="searchForm.whetherRefresh" placeholder="请选择是否刷新" size="small" style="width: 100%">
          <el-option label="已刷新" value="1">已刷新</el-option>
          <el-option label="未刷新" value="0">未刷新</el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="examineStatus">
        <el-select
          v-model="searchForm.examineStatus"
          placeholder="审核状态"
          size="small"
          style="width: 100%"
        >
          <el-option label="待审核" value="1">待审核</el-option>
          <el-option label="已审核" value="2">已审核</el-option>
          <el-option label="已拒绝" value="3">已拒绝</el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="status">
        <el-select
          v-model="searchForm.status"
          placeholder="是否出售"
          size="small"
          style="width: 100%"
        >
          <el-option label="已售" value="1">已售</el-option>
          <el-option label="未售" value="0">未售</el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="createDate">
        <el-date-picker
          v-model="searchForm.createDate"
          type="daterange"
          size="small"
          align="right"
          value-format="yyyy-MM-dd hh:mm:ss"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="refreshList()" size="small"
          >查询</el-button
        >
        <el-button @click="resetSearch()" size="small">重置</el-button>
      </el-form-item>
    </el-form>
    <!-- 导入导出-->
    <el-form
      :inline="true"
      v-show="isImportCollapse"
      class="query-form"
      ref="importForm"
    >
      <el-form-item>
        <el-button type="default" @click="downloadTpl()" size="small"
          >下载模板</el-button
        >
      </el-form-item>
      <el-form-item prop="loginName">
        <el-upload
          class="upload-demo"
          :action="`${this.$http.BASE_URL}/houseinfo/tHouseInfo/import`"
          :on-success="uploadSuccess"
          :show-file-list="true"
        >
          <el-button size="small" type="primary">点击上传</el-button>
          <div slot="tip" class="el-upload__tip">
            只允许导入“xls”或“xlsx”格式文件！
          </div>
        </el-upload>
      </el-form-item>
    </el-form>
    <el-row>
      <el-button
        v-if="hasPermission('houseinfo:tHouseInfo:add')"
        type="primary"
        size="small"
        icon="el-icon-plus"
        @click="add()"
        >新建</el-button
      >
      <el-button
        v-if="hasPermission('houseinfo:tHouseInfo:edit')"
        type="warning"
        size="small"
        icon="el-icon-edit-outline"
        @click="edit()"
        :disabled="dataListSelections.length != 1"
        plain
        >修改</el-button
      >
      <el-button
        v-if="hasPermission('houseinfo:tHouseInfo:del')"
        type="danger"
        size="small"
        icon="el-icon-delete"
        @click="del()"
        :disabled="dataListSelections.length <= 0"
        plain
        >删除
      </el-button>
      <el-button-group class="pull-right">
        <el-button
          type="default"
          size="small"
          icon="el-icon-search"
          @click="
            (isSearchCollapse = !isSearchCollapse), (isImportCollapse = false)
          "
        >
        </el-button>
        <!-- <el-button v-if="hasPermission('houseinfo:tHouseInfo:import')" type="default" size="small" icon="el-icon-upload2" title="导入" @click="isImportCollapse = !isImportCollapse, isSearchCollapse=false"></el-button> -->
        <el-button
          v-if="hasPermission('houseinfo:tHouseInfo:export')"
          type="default"
          size="small"
          icon="el-icon-download"
          title="导出"
          @click="exportExcel()"
        ></el-button>
        <el-button
          type="default"
          size="small"
          icon="el-icon-refresh"
          @click="refreshList"
        >
        </el-button>
      </el-button-group>
    </el-row>
    <el-table
      :data="dataList"
      border
      size="medium"
      @selection-change="selectionChangeHandle"
      @sort-change="sortChangeHandle"
      v-loading="loading"
      class="table"
    >
      <el-table-column
        type="selection"
        header-align="center"
        align="center"
        width="50"
      >
      </el-table-column>
      <el-table-column
        prop="user.nikeName"
        show-overflow-tooltip
        label="发布人"
      >
        <template slot-scope="scope">
          <el-link
            type="primary"
            :underline="false"
            v-if="hasPermission('houseinfo:tHouseInfo:edit')"
            @click="edit(scope.row.id)"
            >{{ scope.row.user.nikeName || '未命名用户'}}</el-link
          >
          <el-link
            type="primary"
            :underline="false"
            v-else-if="hasPermission('houseinfo:tHouseInfo:view')"
            @click="view(scope.row.id)"
            >{{ scope.row.user.nikeName || '未命名用户'}}</el-link
          >
          <span v-else>{{ scope.row.user.nikeName || '未命名用户'}}</span>
          <span
            v-if="!scope.row.user || scope.row.user.delFlags != 0"
            style="color: red"
            >(已注销)</span
          >
        </template>
      </el-table-column>
      <el-table-column prop="phone" show-overflow-tooltip label="联系方式">
      </el-table-column>
      <el-table-column prop="title" show-overflow-tooltip label="标题">
      </el-table-column>
      <!-- <el-table-column
        prop="newOld"
        show-overflow-tooltip
        label="新房/二手">
        <template slot-scope="scope">
          <span v-if="scope.row.newOld==1">新房</span>
          <span v-if="scope.row.newOld==2">二手房</span>
        </template>
      </el-table-column> -->
      <el-table-column prop="type" show-overflow-tooltip label="房源类型">
        <template slot-scope="scope">
          <span v-if="scope.row.type == 1">住宅</span>
          <span v-if="scope.row.type == 2">商铺</span>
          <span v-if="scope.row.type == 3">写字楼</span>
          <span v-if="scope.row.type == 4">厂房</span>
          <span v-if="scope.row.type == 5">土地</span>
          <span v-if="scope.row.type == 6">车位</span>
        </template>
      </el-table-column>
      <!-- <el-table-column
        prop="region"
        show-overflow-tooltip
        label="区域">
      </el-table-column> -->
      <!-- <el-table-column prop="cellName" show-overflow-tooltip label="小区名称">
      </el-table-column> -->
      <el-table-column prop="price" show-overflow-tooltip label="售价">
      </el-table-column>
      <!-- <el-table-column
        prop="houseType"
        show-overflow-tooltip
        label="户型"> 
      </el-table-column>-->
      <!-- <el-table-column
        prop="area"
        show-overflow-tooltip
        label="面积">
      </el-table-column> -->

      <el-table-column prop="status" show-overflow-tooltip label="状态">
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.status == 0">正常</el-tag>
          <el-tag type="danger" v-if="scope.row.status == 1">已售</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="upStatus" show-overflow-tooltip label="上架状态">
        <template slot-scope="scope">
          <el-tag type="danger" v-if="scope.row.upStatus == 0">未上架</el-tag>
          <el-tag type="success" v-if="scope.row.upStatus == 1">已上架</el-tag>
        </template>
      </el-table-column>

      <el-table-column
        prop="examineStatus"
        show-overflow-tooltip
        label="审核状态"
      >
        <template slot-scope="scope">
          <el-tag type="danger" v-if="scope.row.examineStatus == 1"
            >未审核</el-tag
          >
          <el-tag type="success" v-if="scope.row.examineStatus == 2"
            >已审核</el-tag
          >
          <el-tag type="danger" v-if="scope.row.examineStatus == 3"
            >已拒绝</el-tag
          >
        </template>
      </el-table-column>
      <el-table-column prop="isShow" show-overflow-tooltip label="首页显示">
        <template slot-scope="scope">
          <el-switch
            style="display: block"
            v-model="scope.row.isShow"
            active-color="#13ce66"
            inactive-color="#ff4949"
            active-text="显示"
            inactive-text="否"
            active-value="1"
            inactive-value="0"
            @change="changeStatus1($event, scope.row.id)"
          >
          </el-switch>
        </template>
      </el-table-column>

      <el-table-column
        prop="whetherTopHome"
        show-overflow-tooltip
        label="大主页是否显示"
      >
        <template slot-scope="scope">
          <el-switch
            style="display: block"
            v-model="scope.row.whetherTopHome"
            active-color="#13ce66"
            inactive-color="#ff4949"
            active-text="显示"
            inactive-text="否"
            active-value="0"
            inactive-value="1"
            @change="changeBigHomeStatus($event, scope.row.id)"
          >
          </el-switch>
        </template>
      </el-table-column>

      <el-table-column prop="isDelete" show-overflow-tooltip label="是否隐藏">
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.isDelete == '0'"
            >已显示</el-tag
          >
          <el-tag type="danger" v-if="scope.row.isDelete == '1'">已隐藏</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="isDelete" show-overflow-tooltip label="申领房源">
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.isCopy == '0'">否</el-tag>
          <el-tag type="danger" v-if="scope.row.isCopy == '1'">是</el-tag>
        </template>
      </el-table-column>
      <el-table-column
        prop="whetherRefresh"
        show-overflow-tooltip
        label="是否刷新"
      >
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.isCopy == '0'">否</el-tag>
          <el-tag type="danger" v-if="scope.row.isCopy == '1'">是</el-tag>
        </template>
      </el-table-column>
      <!-- <el-table-column
        prop="sort"
        show-overflow-tooltip
        sortable="custom"
        label="排序"
      >
        <template slot-scope="scope">
          <el-input
            style="width: 50px"
            v-model="scope.row.sort"
            placeholder="请输入内容"
            @change="changeStatus2($event, scope.row.id)"
          ></el-input>
        </template>
      </el-table-column> -->
      <el-table-column
        prop="createDate"
        show-overflow-tooltip
        sortable="custom"
        label="创建时间"
      >
      </el-table-column>
      <el-table-column
        prop="auditName"
        show-overflow-tooltip
        label="审核人员"
      >
      </el-table-column>
      <el-table-column
        prop="auditTime"
        show-overflow-tooltip
        sortable="custom"
        label="审核时间"
      > </el-table-column>
      <el-table-column
        header-align="center"
        align="center"
        fixed="right"
        width="200"
        label="操作"
      >
        <template slot-scope="scope">
          <el-button
            v-if="hasPermission('houseinfo:tHouseInfo:view')"
            type="text"
            icon="el-icon-view"
            size="small"
            @click="view(scope.row.id)"
            >查看</el-button
          >
          <el-button
            v-if="hasPermission('houseinfo:tHouseInfo:edit')"
            type="text"
            icon="el-icon-edit"
            size="small"
            @click="edit(scope.row.id)"
            >修改</el-button
          >
          <el-button
            v-if="hasPermission('houseinfo:tHouseInfo:del')"
            type="text"
            icon="el-icon-delete"
            size="small"
            @click="del(scope.row.id)"
            >删除</el-button
          >
          <el-button
            v-if="
              hasPermission('houseinfo:tHouseInfo:updown') &&
              scope.row.upStatus == 0
            "
            type="text"
            icon="el-icon-edit"
            size="small"
            @click="updown(scope.row.id, 1)"
            >上架</el-button
          >
          <el-button
            v-if="
              hasPermission('houseinfo:tHouseInfo:updown') &&
              scope.row.upStatus == 1
            "
            type="text"
            icon="el-icon-edit"
            size="small"
            @click="updown(scope.row.id, 0)"
            >下架</el-button
          >
          <el-button
            v-if="
              hasPermission('houseinfo:tHouseInfo:zl') &&
              scope.row.upStatus == 1 &&
              scope.row.status == 0
            "
            type="text"
            icon="el-icon-edit"
            size="small"
            @click="zl(scope.row.id)"
            >已售</el-button
          >
          <el-button
            v-if="
              hasPermission('houseinfo:tHouseInfo:audit') &&
              scope.row.examineStatus == 1
            "
            type="text"
            icon="el-icon-edit"
            size="small"
            @click="audit(scope.row.id, 2, scope.row.user.id)"
            >通过</el-button
          >
          <el-button
            v-if="
              hasPermission('houseinfo:tHouseInfo:audit') &&
              scope.row.examineStatus == 1
            "
            type="text"
            icon="el-icon-edit"
            size="small"
            @click="jj(scope.row.id, 3, scope.row.user.id)"
            >拒绝</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageNo"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pageSize"
      :total="total"
      background
      layout="total, sizes, prev, pager, next, jumper"
    >
    </el-pagination>
    <!-- 弹窗, 新增 / 修改 -->
    <THouseInfoForms
      ref="tHouseInfoForms"
      @refreshDataList="refreshList"
    ></THouseInfoForms>
  </div>
</template>

<script>
import THouseInfoForms from "./THouseInfoForms";
import GridSelect from "@/components/gridSelect";
export default {
  data() {
    return {
      searchForm: {
        shopId: "",
        phone: "",
        createDate: "",
        transactionType: "2",
        newOld: "",
        title: "",
        type: "",
        region: "",
        cellName: "",
        houseType: "",
        status: "",
        upStatus: "",
        isShow: "",
        user: {
          nikeName: "",
        },
        examineStatus: "",
        whetherRefresh: "",
      },
      value: false,
      sysNo: localStorage.getItem("sysNo"),
      dataList: [],
      valueList: [],
      pageNo: 1,
      pageSize: 10,
      total: 0,
      orderBy: "",
      dataListSelections: [],
      isSearchCollapse: false,
      isImportCollapse: false,
      loading: false,
      furniture: "",
      housingYears: "",
      propertyType: "",
      whetherRefresh: "",
    };
  },
  components: {
    GridSelect,
    THouseInfoForms,
  },
  activated() {
    this.searchForm.examineStatus = this.$route.query.examineStatus;
    this.refreshList(), this.getvalueList();
  },

  methods: {
    // 获取数据列表
    getvalueList() {
      this.$http({
        url: "/valueinfo/tValueInfo/list",
        method: "get",
        params: {
          pageNo: 1,
          pageSize: 999,
          orderBy: this.orderBy,
          type: "1,3,7",
        },
      }).then(({ data }) => {
        if (data && data.success) {
          this.valueList = data.page.list;
        }
      });
    },
    // 获取数据列表
    refreshList() {
      this.loading = true;
      this.$http({
        url: "/houseinfo/tHouseInfo/list",
        method: "get",
        params: {
          pageNo: this.pageNo,
          pageSize: this.pageSize,
          orderBy: this.orderBy,
          beginCreateDate: this.searchForm.createDate[0],
          endCreateDate: this.searchForm.createDate[1],
          ...this.lodash.omit(this.searchForm, "createDate"),
        },
      }).then(({ data }) => {
        if (data && data.success) {
          this.dataList = data.page.list;
          this.total = data.page.count;
          this.loading = false;
        }
      });
    },
    // 每页数
    sizeChangeHandle(val) {
      this.pageSize = val;
      this.pageNo = 1;
      this.refreshList();
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageNo = val;
      this.refreshList();
    },
    // 多选
    selectionChangeHandle(val) {
      this.dataListSelections = val;
    },

    // 排序
    sortChangeHandle(obj) {
      if (obj.order === "ascending") {
        this.orderBy = obj.prop + " asc";
      } else if (obj.order === "descending") {
        this.orderBy = obj.prop + " desc";
      } else {
        this.orderBy = "";
      }
      this.refreshList();
    },
    updown: function (id, upStatus) {
      this.$http({
        url: "/houseinfo/tHouseInfo/updown",
        method: "POST",
        params: { id: id, upStatus: upStatus },
      }).then(({ data }) => {
        if (data && data.success) {
          this.$message.success(data.msg);
          this.refreshList();
        }
        this.loading = false;
      });
    },
    zl: function (id) {
      this.$http({
        url: "/houseinfo/tHouseInfo/zl",
        method: "POST",
        params: { id: id, status: 1 },
      }).then(({ data }) => {
        if (data && data.success) {
          this.$message.success(data.msg);
          this.refreshList();
        }
        this.loading = false;
      });
    },
    changeStatus1: function (isShow, id) {
      console.log(isShow, id);
      let ms = "";
      if (isShow == 1) {
        ms = "置顶";
      } else {
        ms = "取消置顶";
      }
      this.$confirm(`确定`+ ms +`首页显示当前房源吗?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.loading = true;
          this.$http({
            url: "/houseinfo/tHouseInfo/showPage",
            method: "POST",
            params: { id: id, isShow: isShow, upStatus: "", status: "" },
          }).then(({ data }) => {
            if (data && data.success) {
              this.$message.success(data.msg);
              this.refreshList();
            }
            this.loading = false;
          });
        })
        .catch(() => {
          this.refreshList();
        });
    },
    changeBigHomeStatus: function (whetherTopHome, id) {
      console.log(whetherTopHome, id);
      let ms = "";
      if (whetherTopHome == 0) {
        ms = "置顶";
      } else {
        ms = "取消置顶";
      }
      this.$confirm(`确定` + ms + `当前房源吗?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.loading = true;
          this.$http({
            url: "/houseinfo/tHouseInfo/showBigHomePage",
            method: "POST",
            params: { id: id, whetherTopHome: whetherTopHome },
          }).then(({ data }) => {
            if (data && data.success) {
              this.$message.success(data.msg);
              this.refreshList();
            }
            this.loading = false;
          });
        })
        .catch(() => {
          console.log("取消删除");
          this.refreshList();
        });
    },
    changeStatus2: function (sort, id) {
      console.log(sort, id);
      this.$http({
        url: "/houseinfo/tHouseInfo/updateSort",
        method: "POST",
        params: { id: id, sort: sort },
      }).then(({ data }) => {
        if (data && data.success) {
          this.$message.success(data.msg);
          this.refreshList();
        }
        this.loading = false;
      });
    },
    // 新增
    add() {
      this.$refs.tHouseInfoForms.init("add", "");
    },
    // 修改
    edit(id) {
      id =
        id ||
        this.dataListSelections.map((item) => {
          return item.id;
        })[0];
      this.$refs.tHouseInfoForms.init("edit", id);
    },
    // 查看
    view(id) {
      this.$refs.tHouseInfoForms.init("view", id);
    },
    audit(id, examineStatus, userId) {
      if (!userId) {
        this.$message({
          type: "info",
          message: "账号已注销，无需审核！",
        });
        return;
      }
      this.$confirm(`确定当前操作?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.loading = true;
        this.$http({
          url: "/houseinfo/tHouseInfo/audit",
          method: "post",
          params: { id: id, examineStatus: examineStatus, "user.id": userId },
        }).then(({ data }) => {
          if (data && data.success) {
            this.$message.success(data.msg);
            this.refreshList();
          }
          this.loading = false;
        });
      });
    },
    jj(id, examineStatus, userId) {
      if (!userId) {
        this.$message({
          type: "info",
          message: "账号已注销，无需审核！",
        });
        return;
      }
      this.$prompt("请输入拒绝原因", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      })
        .then(({ value }) => {
          if (!value) {
            this.$message.error("请输入拒绝原因");
            return false;
          }
          this.loading = true;
          this.$http({
            url: "/houseinfo/tHouseInfo/audit",
            method: "post",
            params: {
              id: id,
              examineStatus: examineStatus,
              reason: value,
              "user.id": userId,
            },
          }).then(({ data }) => {
            if (data && data.success) {
              this.$message.success(data.msg);
              this.refreshList();
            }
            this.loading = false;
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "取消输入",
          });
        });
    },
    // 删除
    del(id) {
      let ids =
        id ||
        this.dataListSelections
          .map((item) => {
            return item.id;
          })
          .join(",");
      this.$confirm(`确定删除所选项吗?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.loading = true;
        this.$http({
          url: "/houseinfo/tHouseInfo/delete",
          method: "delete",
          params: { ids: ids },
        }).then(({ data }) => {
          if (data && data.success) {
            this.$message.success(data.msg);
            this.refreshList();
          }
          this.loading = false;
        });
      });
    },
    // 导入成功
    uploadSuccess(res, file) {
      if (res.success) {
        this.$message.success({
          dangerouslyUseHTMLString: true,
          message: res.msg,
        });
      } else {
        this.$message.error(res.msg);
      }
    },
    // 下载模板
    downloadTpl() {
      this.$utils.download("/houseinfo/tHouseInfo/import/template");
    },
    exportExcel() {
      this.$utils.download("/houseinfo/tHouseInfo/export");
    },
    resetSearch() {
      this.$refs.searchForm.resetFields();
      this.refreshList();
    },
  },
};
</script>
